/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package org.opensource.jdom.taggen.html.tag;

import org.opensource.jdom.taggen.html.CommonAttributes;

/**
 *
 * A form element that can be represented as a text box, password text box, 
 * check box, radio button, submit button, reset button, hidden input field, 
 * image (which acts as a submit button), file selection box or general button.
 *
 * <h2>Example</h2> <pre><code class="html">
 *&lt;form action="somescript.php" /&gt;
 *	&lt;p&gt;Do you like pie?&lt;/p&gt;
 *	&lt;div&gt;yes <strong>&lt;input type="radio" name="pie" value="yes"
 * checked="checked" /&gt;</strong>&lt;/div&gt;
 *	&lt;div&gt;no <strong>&lt;input type="radio" name="pie" value="no" /&gt;
 * </strong>&lt;/div&gt;
 *	&lt;div&gt;Your name: <strong>&lt;input type="text" name="name" /&gt;
 * </strong>&lt;/div&gt;
 *	&lt;div&gt;<strong>&lt;input type="image" name="submitimage"
 *  src="someimage.gif" /&gt;</strong>&lt;/div&gt;
 *&lt;/form&gt;
 *</code></pre>
 *
 * @see Form
 * @see Textarea
 * @see Select
 * @author sergio.valdez
 */
public class Input extends CommonAttributes{

    public static final String TEXT     = "text";
    public static final String PASSWORD = "password";
    public static final String CHECKBOX = "checkbox";
    public static final String RADIO    = "radio";
    public static final String SUBMIT   = "submit";
    public static final String RESET    = "reset";
    public static final String HIDDEN   = "hidden";
    public static final String IMAGE    = "image";
    public static final String FILE     = "file";
    public static final String BUTTON   = "button";

    /**
     * can be used so that the value of the element can be processed.
     */
    private String cssName;
    /**
     * can be used to specify the type of input. Values can be text (default),
     * password, checkbox, radio, submit, reset, hidden, image, file or button.
     */
    private String type;
    /**
     * can be used to specify the initial value. It is required when type is set
     * to checkbox or radio. It should not be used when type is set to file.
     */
    private String cssValue;
    /**
     * can be used when type is set to checkbox or radio to set the initial
     * state of a check box or radio button to be selected. It must be used in
     * the format checked="checked".
     */
    private boolean checked;
    /**
     * can be used to specify the maximum number of characters allowed in a
     * text box.
     */
    private String maxlength;
    /**
     * can be used when type is set to image to specify the location of an image
     * file.
     */
    private String src;
    /**
     * can be used when type is set to image to specify the alternative text of
     * the image, which should be a short description.
     */
    private String alt;
    /**
     * can be used when type is set to file to specify which file-types should
     * be accepted. This is a comma-separated list of MIME types.
     */
    private String accept;
    /**
     * can be used to disable an element. It must be used in the format
     * disabled="disabled".
     */
    private boolean disabled;
    /**
     * can be used to specify that the value of the element can not be changed.
     * It must be used in the format readonly="readonly".
     */
    private boolean readonly;
    /**
     * can be used to associate a keyboard shortcut to the element.
     */
    private String accesskey;
    /**
     * can be used to specify where the element appears in the tab order of the
     * page.
     */
    private String tabindex;

    /**
     * can be used so that the value of the element can be processed.
     * @return the cssName
     */
    public String getCssName() {
        return cssName;
    }

    /**
     * can be used so that the value of the element can be processed.
     * @param cssName the cssName to set
     */
    public void setCssName(String cssName) {
        this.cssName = cssName;
    }

    /**
     * can be used to specify the type of input. Values can be text (default),
     * password, checkbox, radio, submit, reset, hidden, image, file or button.
     * @return the type
     */
    public String getType() {
        return type;
    }

    /**
     * can be used to specify the type of input. Values can be text (default),
     * password, checkbox, radio, submit, reset, hidden, image, file or button.
     * @param type the type to set
     */
    public void setType(String type) {
        this.type = type;
    }

    /**
     * can be used to specify the initial value. It is required when type is set
     * to checkbox or radio. It should not be used when type is set to file.
     * @return the cssValue
     */
    public String getCssValue() {
        return cssValue;
    }

    /**
     * can be used to specify the initial value. It is required when type is set
     * to checkbox or radio. It should not be used when type is set to file.
     * @param cssValue the cssValue to set
     */
    public void setCssValue(String cssValue) {
        this.cssValue = cssValue;
    }

    /**
     * can be used when type is set to checkbox or radio to set the initial
     * state of a check box or radio button to be selected. It must be used in
     * the format checked="checked".
     * @return the checked
     */
    public boolean isChecked() {
        return checked;
    }

    /**
     * can be used when type is set to checkbox or radio to set the initial
     * state of a check box or radio button to be selected. It must be used in
     * the format checked="checked".
     * @param checked the checked to set
     */
    public void setChecked(boolean checked) {
        this.checked = checked;
    }

    /**
     * can be used to specify the maximum number of characters allowed in a
     * text box.
     * @return the maxlength
     */
    public String getMaxlength() {
        return maxlength;
    }

    /**
     * can be used to specify the maximum number of characters allowed in a
     * text box.
     * @param maxlength the maxlength to set
     */
    public void setMaxlength(String maxlength) {
        this.maxlength = maxlength;
    }

    /**
     * can be used when type is set to image to specify the location of an image
     * file.
     * @return the src
     */
    public String getSrc() {
        return src;
    }

    /**
     * can be used when type is set to image to specify the location of an image
     * file.
     * @param src the src to set
     */
    public void setSrc(String src) {
        this.src = src;
    }

    /**
     * can be used when type is set to image to specify the alternative text of
     * the image, which should be a short description.
     * @return the alt
     */
    public String getAlt() {
        return alt;
    }

    /**
     * can be used when type is set to image to specify the alternative text of
     * the image, which should be a short description.
     * @param alt the alt to set
     */
    public void setAlt(String alt) {
        this.alt = alt;
    }

    /**
     * can be used when type is set to file to specify which file-types should
     * be accepted. This is a comma-separated list of MIME types.
     * @return the accept
     */
    public String getAccept() {
        return accept;
    }

    /**
     * can be used when type is set to file to specify which file-types should
     * be accepted. This is a comma-separated list of MIME types.
     * @param accept the accept to set
     */
    public void setAccept(String accept) {
        this.accept = accept;
    }

    /**
     * can be used to disable an element. It must be used in the format
     * disabled="disabled".
     * @return the disabled
     */
    public boolean isDisabled() {
        return disabled;
    }

    /**
     * can be used to disable an element. It must be used in the format
     * disabled="disabled".
     * @param disabled the disabled to set
     */
    public void setDisabled(boolean disabled) {
        this.disabled = disabled;
    }

    /**
     * can be used to specify that the value of the element can not be changed.
     * It must be used in the format readonly="readonly".
     * @return the readonly
     */
    public boolean isReadonly() {
        return readonly;
    }

    /**
     * can be used to specify that the value of the element can not be changed.
     * It must be used in the format readonly="readonly".
     * @param readonly the readonly to set
     */
    public void setReadonly(boolean readonly) {
        this.readonly = readonly;
    }

    /**
     * can be used to associate a keyboard shortcut to the element.
     * @return the accesskey
     */
    public String getAccesskey() {
        return accesskey;
    }

    /**
     * can be used to associate a keyboard shortcut to the element.
     * @param accesskey the accesskey to set
     */
    public void setAccesskey(String accesskey) {
        this.accesskey = accesskey;
    }

    /**
     * can be used to specify where the element appears in the tab order of the
     * page.
     * @return the tabindex
     */
    public String getTabindex() {
        return tabindex;
    }

    /**
     * can be used to specify where the element appears in the tab order of the
     * page.
     * @param tabindex the tabindex to set
     */
    public void setTabindex(String tabindex) {
        this.tabindex = tabindex;
    }
}
